using System;
using System.ComponentModel;
using System.ComponentModel.Design.Serialization;
using System.Globalization;

namespace Oracle.ManagedDataAccess.Client
{
	public class OracleParameterTypeConverter : TypeConverter
	{
		public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
		{
			if (!(destinationType == typeof(InstanceDescriptor)))
			{
				return base.CanConvertTo(context, destinationType);
			}
			return true;
		}

		public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
		{
			try
			{
				if (value != null && destinationType == typeof(InstanceDescriptor))
				{
					return new InstanceDescriptor(value.GetType().GetConstructor(new Type[0]), new object[0], isComplete: false);
				}
			}
			catch
			{
			}
			return base.ConvertTo(context, culture, value, destinationType);
		}
	}
}
